<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>二手车出售信息</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="css/usedcar.css">
	
	<script type="text/javascript">
			function myUsedCarSaleInfo(){
				var eauser = "${session.eauser}";
				if(eauser == ""){
					alert("请先登录!");
					return;
				}
				else{
					window.location = "usedcar/viewSaleUsedCar_showMyUsedCarSale";
				}
					
			}
			
			function isLoad(){
				var eauser = "${session.eauser}";
				if(eauser == ""){
					alert("请先登录!");
					return;
				}
				else{
					window.location = "usedcar/viewSaleUsedCar_add";
				}
		}
		</script>
	</head>

	<body>
		<div id="main">
			<div style="position: relative;">
				<a target="content" href="javascript:void(0)" onclick="isLoad()"
					class="button_sale" rel="nofollow"></a>
			</div>
			<div class="div_top">
				<dl class="secitem">
					<dt class="secitem_brand">
						品牌：
					</dt>
					<dd>
						<c:choose>
							<c:when test="${request.isBrand == 0}"><a href="javascript:void(0)" style="color: red;">不限</a></c:when>
							<c:otherwise><a href="usedcar/viewSaleUsedCar_show?department=${department1}&price=${price1}&carYear=${carYear1}">不限</a></c:otherwise>
						</c:choose>
						<s:iterator value="#request.brandList" var="brand">
							<c:choose> 
								<c:when test="${brand == brand1}">
									<a href="javascript:void(0)" style="color: red;"><s:property value="#brand" /> </a>
								</c:when>
								<c:otherwise>
									<a href="usedcar/viewSaleUsedCar_show?brand=${brand}&department=${department1}&price=${price1}&carYear=${carYear1}"><s:property value="#brand" /> </a>
								</c:otherwise>
							</c:choose>
						</s:iterator>
					</dd>
				</dl>

				<dl class="secitem">
					<dt class="secitem_brand">
						车系：
					</dt>
					<dd>
						<c:choose>
							<c:when test="${request.isDepartment == 0}"><a href="javascript:void(0)" style="color: red;">不限</a></c:when>
							<c:otherwise><a href="usedcar/viewSaleUsedCar_show?brand=${brand1}&price=${price1}&carYear=${carYear1}">不限</a></c:otherwise>
						</c:choose>
						<s:iterator value="#request.departmentList" var="department">
							<c:choose> 
								<c:when test="${department == department1}">
									<a href="javascript:void(0)" style="color: red;"><s:property value="#department" /> </a>
								</c:when>
								<c:otherwise>
									<a href="usedcar/viewSaleUsedCar_show?brand=${brand1}&department=${department}&price=${price1}&carYear=${carYear1}"><s:property value="#department" /> </a>
								</c:otherwise>
							</c:choose>
						</s:iterator>
					</dd>
				</dl>
				<dl class="secitem">
					<dt class="secitem_brand">
						价格：
					</dt>
					<dd>
						<c:choose>
							<c:when test="${request.isPrice == 0}"><a href="javascript:void(0)" style="color: red;">不限</a></c:when>
							<c:otherwise><a href="usedcar/viewSaleUsedCar_show?brand=${brand1}&department=${department1}&carYear=${carYear1}">不限</a></c:otherwise>
						</c:choose>
						
						<s:iterator value="#request.priceList" var="price">
							<c:choose> 
								<c:when test="${price == price1}">
									<a href="javascript:void(0)" style="color: red;"><s:property value="#price" /> </a>
								</c:when>
								<c:otherwise>
									<a href="usedcar/viewSaleUsedCar_show?brand=${brand1}&department=${department1}&price=${price}&carYear=${carYear1}"><s:property value="#price" /> </a>
								</c:otherwise>
							</c:choose>
						</s:iterator>
					</dd>
				</dl>
				<dl class="secitem">
					<dt class="secitem_brand">
						车龄：
					</dt>
					<dd>
						<c:choose>
							<c:when test="${request.isCarYear == 0}"><a href="javascript:void(0)" style="color: red;">不限</a></c:when>
							<c:otherwise><a href="usedcar/viewSaleUsedCar_show?brand=${brand1}&department=${department1}&price=${price1}">不限</a></c:otherwise>
						</c:choose>
						
						<s:iterator value="#request.carYearList" var="carYear">
							<c:choose> 
								<c:when test="${carYear == carYear1}">
									<a href="javascript:void(0)" style="color: red;"><s:property value="#carYear" /> </a>
								</c:when>
								<c:otherwise>
									<a href="usedcar/viewSaleUsedCar_show?brand=${brand1}&department=${department1}&price=${price1}&carYear=${carYear}"><s:property value="#carYear" /> </a>
								</c:otherwise>
							</c:choose>
						</s:iterator>
					</dd>
				</dl>
			</div>
			<a href="javascript:void(0)" style="font-size: 18px;font-weight: bold;" onclick="myUsedCarSaleInfo();">我发布的出售信息</a>
			<br />
			<br />
			<table class="tbimg" cellpadding="0" cellspacing="0">
				<s:iterator value="#request.usedCarSaleList" var="usedCar">
					<tr onmouseover="this.style.background='#FFE4D2'"
						onmouseout="this.style.background='#FFF'">
						<td class="img">
							<a href="usedcar/viewSaleUsedCar_showSaleInfo?id=${usedCar.id}" rel="nofollow" target="_blank"><img src="${usedCar.imageUrl}" /> </a>
						</td>
						<td class="t">
							<a href="usedcar/viewSaleUsedCar_showSaleInfo?id=${usedCar.id}" target="_blank" class="t"><s:property
									value="#usedCar.title" /> </a>
							<br />
							<s:property value="#usedCar.intro" />
							<br />
							排量
							<s:property value="#usedCar.dispalcement" />
							升
							<span class='c_ccc'>/</span>购于
							<fmt:formatDate value="${usedCar.buyDate}" pattern="yyyy年MM月" />
							<span class='c_ccc'>/</span>
							<s:property value="#usedCar.mileage" />
							万公里
						</td>
						<td class="tc">
							<b class='pri'><s:property value="#usedCar.money" /> </b> 万元
						</td>
						<td>
						</td>
					</tr>
				</s:iterator>
			</table>
			<br />
			<div class="pager mb10">
				<a href="usedcar/viewSaleUsedCar_show?brand=${brand1}&department=${department1}&price=${price1}&carYear=${carYear1}&no=1"><span>首页</span></a>
				<c:if test="${requestScope.pageNoSale != 1}">
					<a class="prv" href="usedcar/viewSaleUsedCar_show?brand=${brand1}&department=${department1}&price=${price1}&carYear=${carYear1}&no=${requestScope.pageNoSale-1}"><span>上一页</span></a>
				</c:if>
				<c:forEach var="i" begin="${requestScope.pageNoCenterSale -2 }"
					end="${requestScope.pageNoCenterSale + 2}">
					<c:if test="${i <= requestScope.totalNoSale }">
						<c:choose>
							<c:when test="${i == requestScope.pageNoSale}">
								<a href="javascript:void(0)"><strong><span>${i}</span></strong></a>
							</c:when>
							<c:otherwise>
								<a href="usedcar/viewSaleUsedCar_show?brand=${brand1}&department=${department1}&price=${price1}&carYear=${carYear1}&no=${i}"><span>${i}</span></a>
							</c:otherwise>
						</c:choose>
					</c:if>
				</c:forEach>
				<c:if test="${requestScope.pageNoSale +4 < requestScope.totalNoSale}">
					<a class="next" href="usedcar/viewSaleUsedCar_show?brand=${brand1}&department=${department1}&price=${price1}&carYear=${carYear1}&no=${requestScope.pageNoSale+1}"><span>下一页</span></a>
				</c:if>
				<a href="usedcar/viewSaleUsedCar_show?brand=${brand1}&department=${department1}&price=${price1}&carYear=${carYear1}&no=${requestScope.totalNoSale}"><span>末页</span></a>
				&nbsp;&nbsp;&nbsp;&nbsp;共有<label style="color: red;">${requestScope.totalSale}</label>条信息
			</div>
		</div>
	</body>
</html>
